﻿<UserControl x:Class="AesonXamlControls.Test.Views.HomePage.HomePage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d" xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Mvvm;assembly=Microsoft.Practices.Prism.Mvvm.Desktop"
             xmlns:config="clr-namespace:AesonXamlControls.Test.Config"
             xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:mvvm="clr-namespace:Microsoft.Practices.Prism.Mvvm;assembly=Microsoft.Practices.Prism.Mvvm.Desktop"
             xmlns:interactivity="http://www.codeplex.com/prism"
             xmlns:customPopupContent="clr-namespace:AesonXamlControls.Test.Views.CustomPopupContent"
             xmlns:customPopupWithReturn="clr-namespace:AesonXamlControls.Test.Views.CustomPopupWithReturn"
             xmlns:aesonPopup="clr-namespace:AesonXamlControls.Interaction.AesonPopup;assembly=AesonXamlControls"
             xmlns:aesonPopupContent="clr-namespace:AesonXamlControls.Test.Views.AesonPopupContent"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             xmlns:aesonBusyIndicator="clr-namespace:AesonXamlControls.Interaction.AesonBusyIndicator;assembly=AesonXamlControls"
             mvvm:ViewModelLocator.AutoWireViewModel="True" d:DesignWidth="292.507" d:DesignHeight="383.881" >

    <i:Interaction.Triggers>

        <interactivity:InteractionRequestTrigger SourceObject="{Binding NotificationRequest}" >
            <interactivity:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True" ></interactivity:PopupWindowAction>
        </interactivity:InteractionRequestTrigger>

        <interactivity:InteractionRequestTrigger SourceObject="{Binding ConfirmationRequest}" >
            <interactivity:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True" ></interactivity:PopupWindowAction>
        </interactivity:InteractionRequestTrigger>

        <interactivity:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewRequest}" >
            <interactivity:PopupWindowAction IsModal="True" CenterOverAssociatedObject="True">
                <interactivity:PopupWindowAction.WindowContent>
                    <customPopupContent:CustomPopupView />
                </interactivity:PopupWindowAction.WindowContent>
            </interactivity:PopupWindowAction>
        </interactivity:InteractionRequestTrigger>

        <interactivity:InteractionRequestTrigger SourceObject="{Binding CustomPopupViewWithReturnRequest, Mode=OneTime}" >
            <interactivity:PopupWindowAction  IsModal="True" CenterOverAssociatedObject="True" >
                <interactivity:PopupWindowAction.WindowContent>
                    <customPopupWithReturn:GetDataView/>
                </interactivity:PopupWindowAction.WindowContent>
            </interactivity:PopupWindowAction>
        </interactivity:InteractionRequestTrigger>

        <interactivity:InteractionRequestTrigger SourceObject="{Binding AesonPopupViewWithReturnRequest, Mode=OneTime}" >
            <aesonPopup:AesonPopupAction IsModal="True" CenterOverAssociatedObject="True"  >
                <aesonPopup:AesonPopupAction.WindowContent >
                    <aesonPopupContent:ChildWindowsContent/>
                </aesonPopup:AesonPopupAction.WindowContent>
            </aesonPopup:AesonPopupAction>
        </interactivity:InteractionRequestTrigger>



    </i:Interaction.Triggers>

    <Grid>
        <i:Interaction.Behaviors>
            <ei:DataStateBehavior Binding="{Binding IsBusy}" Value="True" TrueState="Loading" FalseState="Normal"/>
        </i:Interaction.Behaviors>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup>
                <VisualState x:Name="Normal"/>
                <VisualState x:Name="Loading">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="busyIndicator">
                            <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                <DiscreteObjectKeyFrame.Value>
                                    <Visibility>Visible</Visibility>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" ></RowDefinition>
                <RowDefinition Height="10*" ></RowDefinition>
            </Grid.RowDefinitions>
            <StackPanel Orientation="Horizontal" >
                <Label Content="{Binding Message}" ></Label>
            </StackPanel>
            <WrapPanel Grid.Row="1" Margin="10,50,10,40" >
                <controls:Tile  Command="{Binding NotificationCommand}"  >Notification</controls:Tile>
                <controls:Tile  Command="{Binding ConfirmationCommand}" >Confirmation</controls:Tile>
                <controls:Tile  Command="{Binding CustomPopupCommand}" >
                    <TextBlock TextWrapping="Wrap" Text="Custom Popup Content"/>
                </controls:Tile>
                <controls:Tile  Command="{Binding CustomPopupWithReturnCommand}" >
                    <TextBlock Width="123" TextWrapping="Wrap" Text="Custom Popup Content with return"/>
                </controls:Tile>
                <controls:Tile  Command="{Binding AesonPopupWithReturnCommand}" >
                    <TextBlock   Width="123" TextWrapping="Wrap" Text="Aeson ChildWindows with return"/>
                </controls:Tile>
                <controls:Tile  Command="{Binding ShowBusyCommand}" >Aeson BusyIndicator</controls:Tile>
            </WrapPanel>
        </Grid>
        <aesonBusyIndicator:AesonBusyIndicator x:Name="busyIndicator" Visibility="Collapsed" ></aesonBusyIndicator:AesonBusyIndicator>
    </Grid>
</UserControl>
